#include <iostream>
#include "src/FramesIO.hpp"
#define SAVE

int main() {

    cv::VideoCapture camera;

    camera.open(0);
    Moduels::FramesIO::FrameProperty format;
    format.Fps=5;
    format.FrameSize=cv::Size(1280, 720);
    format.Root=".";
#ifdef SAVE
    Moduels::FramesIO::VideoRecorder maker(format);
    Moduels::FramesIO::ImageRecorder maker1(format);
#endif

#ifdef READ
    Moduels::FramesIO::VideoReader reader(format);

    while(1)
    {
        cv::imshow("Video",reader.GetCurrentPicture());
        cv::waitKey(1);
    }
#endif
#ifdef SAVE
    int id=1;
    while (id++)
    {
//        if(id==30)break;
        camera.grab();
        cv::Mat image;
        camera>>image;
        maker1.AddFrameToImage(image);
        maker.AddFrameToVideo(image);
    }
#endif
    std::cout << "Hello, World!" << std::endl;
    return 0;
}
